/**
 * <p>Copyright (c) 2011 深圳市鹏途信息技术有限公司 </p>
 * <p>				   All right reserved. 		     </p>
 * 
 * <p>项目名称 ： 	东莞交通工程质量监督综合业务系统        </p>
 * <p>创建者   :	Administrator 
 * 
 * <p>描   述  :   DetectAction.java for com.pengtu.web.detect    </p>
 * 
 * <p>最后修改 : $: 2011-8-12-上午11:13:44 v 1.0.0	 Administrator   $     </p>
 * 
 */

package com.pengtu.web.detect;

import java.io.File;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.TreeSet;

import javax.servlet.ServletOutputStream;

import jxl.write.WritableWorkbook;

import org.apache.commons.lang.StringUtils;
import org.apache.struts2.convention.annotation.Result;
import org.apache.struts2.convention.annotation.Results;
import org.jfree.chart.JFreeChart;
import org.jfree.chart.servlet.ServletUtilities;
import org.jfree.data.category.DefaultCategoryDataset;
import org.springframework.beans.factory.annotation.Autowired;

import com.pengtu.Constants;
import com.pengtu.dao.Page;
import com.pengtu.dao.QueryFilter;
import com.pengtu.dao.QueryFilter.MatchType;
import com.pengtu.entity.app.Attachment;
import com.pengtu.entity.app.User;
import com.pengtu.entity.detect.Bridgespot;
import com.pengtu.entity.detect.Materialspot;
import com.pengtu.entity.detect.PileSpot;
import com.pengtu.entity.detect.Safetyspot;
import com.pengtu.entity.detect.SpotReport;
import com.pengtu.entity.detect.StructureSpot;
import com.pengtu.entity.detect.SurfaceSpot;
import com.pengtu.entity.detect.TunnelSpot;
import com.pengtu.entity.project.ProjectInfo;
import com.pengtu.integration.chart.JfreeChartBean;
import com.pengtu.model.ProjectModel;
import com.pengtu.model.SpotReportVo;
import com.pengtu.security.SpringSecurityUtils;
import com.pengtu.service.app.SystemManager;
import com.pengtu.service.detect.DetectManager;
import com.pengtu.service.project.ProjectManager;
import com.pengtu.utils.DateUtils;
import com.pengtu.utils.JFreeChartUtils;
import com.pengtu.utils.LabelHelper;
import com.pengtu.utils.UploadFile;
import com.pengtu.utils.ZipHelper;
import com.pengtu.utils.web.Struts2Utils;
import com.pengtu.web.BaseActionSupport;

/**
 * 
 * DetectAction
 * 
 * 2011-8-12 上午11:13:44
 * 
 * @version 1.0.0
 * 
 */
@Results({ @Result(name = BaseActionSupport.RELOAD, location = "${ctx}/detect/detect!proj.action?projectId=${projectId}&decorator=${paramdecorator}&confirm=${paramconfirm}&nav=0", type = "redirect") })
public class DetectAction extends BaseActionSupport<SpotReport> {

	/**
	 * serialVersionUID:TODO
	 * 
	 * @since 1.0.0
	 */

	private static final long serialVersionUID = 1L;
	private String id;
	private String projectId;
	private String[] items;
	private User user;
	private String bat;
	private String ch;
	private String batch;
	private String startTime;
	private String endTime;
	private String yearTime;
	private String yearTime2;
	private String startJidu;
	private String endJidu;
	private String projectName;
	private String startMonth;
	private String endMonth;
	private String startYear;
	private String endYear;
	
	private String zbJidu;
	private String zbyearTime;
	
	private String kaishi;
	private String biaoduan;
	
	private JfreeChartBean jfreeChartBean = new JfreeChartBean();
	
	private SpotReportVo spotReportVo;
	private SpotReport spotReport;
	private Bridgespot bridgespot;
	private Materialspot materialspot;
	private Safetyspot safetyspot;
	private StructureSpot structurespot;
	private SurfaceSpot surfacespot;
	private TunnelSpot tunnelspot;
	private PileSpot pilespot;
	
	private String[] luji;
	private String[] lumian;
	private String[] qiaoliang;
	private String[] suidao;
	private String[] safe;
	private String[] cailiao;
	
	private String alltotal;
	private String lujiString;
	private String lumianString;
	private String qiaoliangString;
	private String suidaoString;
	private String safeString;
	private String cailiaoString;
	private String zhibiaoString;
	
	private String townItems;
	private String roadItems;
	private String levelItems;
	private String planTypes;
	private Page<SpotReport> page = new Page<SpotReport>(10);
	private Page<ProjectInfo> page1 = new Page<ProjectInfo>(5);
	private DetectManager detectManager;
	private ProjectManager projectManager;
	private SystemManager systemManager;
	private List<String> autowns = new ArrayList<String>();
	
	private List<File> upload;
	private List<String> uploadFileName;
	private List<String> uploadContentType;
	
	public String proj() throws Exception {
		QueryFilter filters = QueryFilter.buildFromHttpRequest(Struts2Utils
				.getRequest());
		// 设置默认排序方式
		if (!page.isOrderBySetted()) {
			page.setOrderBy("id");
			page.setOrder(Page.DESC);
		}
		filters.addFilter("projectInfo.id", projectId, MatchType.EQ);
		page = detectManager.getSpotreportList(page, filters);
		if(!page.getResult().isEmpty()) {
			SpotReport spotReport =	page.getResult().get(0);
			ProjectInfo	proj = spotReport.getProjectInfo();
			ProjectModel projectModel =  new ProjectModel();
			projectModel.setProjId(projectId);
			projectModel.setProjName(proj.getProjName());
			Struts2Utils.setSessionAttribute("projectModel", projectModel);
		}
		return "proj";
	}
	
	/**
	 * 
	 * allproj:
	 * 适用:全部工程监督数据列表
	 * @return
	 * @throws Exception 
	 * @exception 
	 * @since  1.0.0
	 */
	public String list() throws Exception {
		
		// 设置默认排序方式
		if (!page.isOrderBySetted()) {
			page.setOrderBy("createDate");
			page.setOrder(Page.DESC);
		}
		page = detectManager.getSpotreportListall(page,startTime,endTime,batch,projectName);
//		page = detectManager.getSpotreportList(page, filters);
		return SUCCESS;
		
	}

	@Override
	public String input() throws Exception {
		ProjectInfo proj = projectManager.getProj("id", projectId);
		if (StringUtils.isNotEmpty(proj.getAtTown())) {
			String [] arr  = proj.getAtTown().split(",");
			for (int i = 0; i < arr.length; i++) { 
				autowns.add(arr[i].trim());
			}
		}
		Struts2Utils.getRequest().setAttribute("projectInfo",proj);
		user = SpringSecurityUtils.getCurrentUser();
		String batch = spotReport.getBatch();
		if (batch != null && batch.length()>=7) {
			bat = batch.substring(0, 7);
			ch = batch.substring(7);
		}
		return INPUT;
	}

	@Override
	public String save() throws Exception {
		user = SpringSecurityUtils.getCurrentUser();
		String batch = (bat) + ch;
		String locale = spotReport.getLocale();
		locale = locale.replaceAll(",", "、"); 
		 if(locale.length()>1 ){
			 locale= locale.substring(0,locale.lastIndexOf("、"));
		 }
		spotReport.setLocale(locale);
		spotReport.setBatch(batch);
		if (StringUtils.isNotEmpty(structurespot.getId())) {
			structurespot = detectManager.getStructurespot(structurespot
					.getId());
		}
		if (StringUtils.isNotEmpty(surfacespot.getId())) {
			surfacespot = detectManager.getSurfacespot(surfacespot.getId());
		}
		if (StringUtils.isNotEmpty(tunnelspot.getId())) {
			tunnelspot = detectManager.getTunnelspot(tunnelspot.getId());
		}
		if (StringUtils.isNotEmpty(bridgespot.getId())) {
			bridgespot = detectManager.getBridgespot(bridgespot.getId());
		}
		if (StringUtils.isNotEmpty(materialspot.getId())) {
			materialspot = detectManager.getMaterialspot(materialspot.getId());
		}
		if (StringUtils.isNotEmpty(safetyspot.getId())) {
			safetyspot = detectManager.getSafetyspot(safetyspot.getId());
		}
		if (StringUtils.isNotEmpty(pilespot.getId())) {
			pilespot = detectManager.getPilespot(pilespot.getId());
		}
		structurespot.setProjectId(projectId);
		surfacespot.setProjectId(projectId);
		tunnelspot.setProjectId(projectId);
		bridgespot.setProjectId(projectId);
		materialspot.setProjectId(projectId);
		safetyspot.setProjectId(projectId);
		pilespot.setProjectId(projectId);
		
		
		structurespot.setReportdate(spotReport.getReportdate());
		surfacespot.setReportdate(spotReport.getReportdate());
		tunnelspot.setReportdate(spotReport.getReportdate());
		bridgespot.setReportdate(spotReport.getReportdate());
		materialspot.setReportdate(spotReport.getReportdate());
		safetyspot.setReportdate(spotReport.getReportdate());
		pilespot.setReportdate(spotReport.getReportdate());
		
		ProjectInfo projectInfo = projectManager.getProj("id", projectId);
		spotReport.setProjectInfo(projectInfo);
		detectManager.saveMany(structurespot, surfacespot, tunnelspot,
				bridgespot, materialspot, safetyspot, pilespot, spotReport, items);
		String rootPath = Struts2Utils.getAppRootPath();
		if (null != upload) {
			for (int i = 0; i < upload.size(); i++) {
				Attachment attachmention = new Attachment();
				attachmention.setUpfile(upload.get(i));
				attachmention.setUpfileFileName(uploadFileName.get(i));
				attachmention.setType(uploadContentType.get(i));
				attachmention.setTableId(spotReport.getId());
				attachmention.setTableField("spotReportFile");
				attachmention.setTableName("spotReport");
				attachmention.setFileTime(new Date());
				attachmention.setPartName(user.getUserName());
				systemManager.uploadFile(rootPath, attachmention);
			}
		}
		return RELOAD;
	}

	@Override
	public String delete() throws Exception {
		detectManager.deleteSpotreport(id);
		return RELOAD;
	}

	/**
	 * 
	 * excel:
	 * 适用:导出一条SpotReport记录的Excel表
	 * @throws Exception 
	 * @exception 
	 * @since  1.0.0
	 */
	public void excel() throws Exception {
		
		//样板Excel
		String examplePath = Struts2Utils.getAppRootPath() + "\\resources\\jiandu.xls";
		//当前时间
		Long currentDate = System.currentTimeMillis();
		
		ServletOutputStream responOut = Struts2Utils.getResponse().getOutputStream();
		QueryFilter filters = QueryFilter.buildFromHttpRequest(Struts2Utils
				.getRequest());
		List<SpotReport> list = detectManager
				.getSpotreportListByProperty(filters);
		DefaultCategoryDataset dataset = new DefaultCategoryDataset();
		dataset = detectManager.CategoryDataset(dataset, spotReport.getBatch(), list);
		String x = "监督抽检项目";
		String y = "项目合格百分比(%)";
		String signName = "";
		if(list.get(0).getSignid() != null){
			signName = "(标段为"+projectManager.getSign("id", list.get(0).getSignid()).getContractOrder()+")";
		}
		String title = spotReport.getProjectInfo().getProjName()+"工程第"+spotReport.getBatch()+"批次"+ signName +"的图形比较"; 
		String path = Struts2Utils.getAppRootPath()+Constants.FILE_SEP+"temp"+Constants.FILE_SEP+projectId+Constants.FILE_SEP+"images"+Constants.FILE_SEP;
		(new File(path)).mkdirs();
		String imagePath  = Struts2Utils.getAppRootPath()+Constants.FILE_SEP+"temp/"+projectId+"/images/"+currentDate+"pie.png";
		JFreeChart chart = JFreeChartUtils.createBarChart(dataset, title, x, y, false);
		JFreeChartUtils.drawToOutputStream(path+currentDate+"pie.png", chart, 680, 400);
		
		WritableWorkbook wwb = detectManager.excelOut(list,imagePath,responOut,examplePath);
		UploadFile.downloadExcelFile(wwb, Struts2Utils.getResponse(),
				DateUtils.convertDateToMonthString(list.get(0).getReportdate())
				+list.get(0).getProjectInfo().getProjName()
				+signName
				+ "第" + list.get(0).getBatch()
				+ "批次监督组监督工作情况及检测统计.xls");
	}
	
	public void prepareExcel() throws Exception {
		prepareModel();
	}
	/**
	 * 
	 * excelOut:同一工程同一批次
	 * 适用:
	 * @throws Exception 
	 * @exception 
	 * @since  1.0.0
	 */
	public void excelOut() throws Exception {
		
		//样板Excel
		String examplePath = Struts2Utils.getAppRootPath() + "\\resources\\jiandu.xls";
		//当前时间
		Long currentDate = System.currentTimeMillis();
		ServletOutputStream responOut = Struts2Utils.getResponse().getOutputStream();
		QueryFilter filters = QueryFilter.buildFromHttpRequest(Struts2Utils
				.getRequest());
		filters.addFilter("projectInfo.id", projectId, MatchType.EQ);
		filters.addFilter("batch", batch, MatchType.EQ);
		filters.addFilter("reportdate", DateUtils.convertStringToStrigulaDate(startTime),MatchType.GE);
		filters.addFilter("reportdate", DateUtils.convertStringToStrigulaDate(endTime),MatchType.LT);
		List<SpotReport> list = detectManager
				.getSpotreportListByProperty(filters);
		
		DefaultCategoryDataset dataset = new DefaultCategoryDataset();
		
		dataset = detectManager.CategoryDatasetExcelOut(dataset, list);
		ProjectInfo projectInfo = projectManager.getProj("id", projectId);
		String title = projectInfo.getProjName()+"工程第"+batch+"批次的不同标段图形比较"; 
		String x = "监督抽检项目";
		String y = "项目合格百分比(%)";
		String path = Struts2Utils.getAppRootPath()+Constants.FILE_SEP+"temp"+Constants.FILE_SEP+projectId+Constants.FILE_SEP+"images"+Constants.FILE_SEP;
		(new File(path)).mkdirs();
		String imagePath  = Struts2Utils.getAppRootPath()+Constants.FILE_SEP+"temp/"+projectId+"/images/"+currentDate+"pie.png";
		JFreeChart chart = JFreeChartUtils.createBarChart(dataset, title, x, y, false);
		JFreeChartUtils.drawToOutputStream(path+currentDate+"pie.png", chart, 680, 400);
		
		WritableWorkbook wwb = detectManager.excelOut(list,imagePath,responOut,examplePath);
		UploadFile.downloadExcelFile(wwb, Struts2Utils.getResponse(),
				list.get(0).getProjectInfo().getProjName()
						+ "第" + batch
						+ "批次监督组监督工作情况及检测统计.xls");
	}

	/**
	 * 
	 * excelOutDif:同一工程不同批次
	 * 适用:
	 * @throws Exception 
	 * @exception 
	 * @since  1.0.0
	 */
	public void excelOutDif() throws Exception {
		
		
		//样板Excel
		String examplePath = Struts2Utils.getAppRootPath() + "\\resources\\jiandu.xls";
		//当前时间
		Long currentDate = System.currentTimeMillis();
		
		QueryFilter filters = QueryFilter.buildFromHttpRequest(Struts2Utils
				.getRequest());
		filters.addFilter("projectInfo.id", projectId, MatchType.EQ);
		filters.addFilter("reportdate", DateUtils.convertStringToStrigulaDate(startTime),MatchType.GE);
		filters.addFilter("reportdate", DateUtils.convertStringToStrigulaDate(endTime),MatchType.LT);
		
		//list的到是该工程的全部记录
		List<SpotReport> list = detectManager.getSpotreportListByProperty(filters);
		
		//通过treeSet过滤batch批次，treeSet它会自动按小到大的顺序排列
		TreeSet<String> p = new TreeSet<String>();
		for(int i = 0; i< list.size(); i ++){
			SpotReport spotReport = list.get(i);
			p.add(spotReport.getBatch());
		}
		if(list.size()>0){
			
		//生成文件路径
		String path = Struts2Utils.getAppRootPath()+Constants.FILE_SEP+"temp"+Constants.FILE_SEP+projectId+Constants.FILE_SEP+currentDate+Constants.FILE_SEP;
		
		//iter中包含的是批次
		Iterator<String> iter = p.iterator();
		
		//设置li是为了后面用到批次中一个最小的和一个最大的batch（批次）
		List<String> li = new ArrayList<String>();
		
		String ads ="批次.xls";
		//String title = "同一工程不同批次的图形比较"; 
		String x = "监督抽检项目";
		String y = "项目合格百分比(%)";
		
		String ImageFilepath = Struts2Utils.getAppRootPath()+Constants.FILE_SEP+"temp"+Constants.FILE_SEP+projectId+Constants.FILE_SEP+"images"+Constants.FILE_SEP;
		(new File(ImageFilepath)).mkdirs();
		ProjectInfo projectInfo = projectManager.getProj("id", projectId);
		DefaultCategoryDataset dataset = new DefaultCategoryDataset();
		while(iter.hasNext()){
        	String nes  =  iter.next();
        	li.add(nes);//将批次存到list中
			QueryFilter filters1 = new QueryFilter();
			filters1.addFilter("projectInfo.id", projectId, MatchType.EQ);
			filters1.addFilter("batch",nes, MatchType.EQ);
			filters1.addFilter("reportdate", DateUtils.convertStringToStrigulaDate(startTime),MatchType.GE);
			filters1.addFilter("reportdate", DateUtils.convertStringToStrigulaDate(endTime),MatchType.LT);
			
			List<SpotReport> list1 = detectManager.getSpotreportListByProperty(filters1);
			
			dataset = detectManager.CategoryDataset(dataset, nes, list1);
			Long currentDate1 = System.currentTimeMillis();
			String imagePath1  = Struts2Utils.getAppRootPath()+Constants.FILE_SEP+"temp/"+projectId+"/images/"+currentDate1+"pie.png";
			DefaultCategoryDataset dataset1 = new DefaultCategoryDataset();
			dataset1 = detectManager.CategoryDatasetExcelOut(dataset1, list1);
			JFreeChart chart1 = JFreeChartUtils.createBarChart(dataset1, projectInfo.getProjName()+"工程第"+nes+"批次的不同标段图形比较", x, y, false);
			JFreeChartUtils.drawToOutputStream(ImageFilepath+currentDate1+"pie.png", chart1, 680, 400);
			
			detectManager.excelOutDif(list1,path+nes+ads,imagePath1,projectId,examplePath);
		}
		
		JFreeChart chart = JFreeChartUtils.createBarChart(dataset, projectInfo.getProjName()+"工程不同批次的汇总图形比较", x, y, false);
		JFreeChartUtils.drawToOutputStream(path+projectInfo.getProjName()+"工程不同批次的汇总图形比较.png", chart, 680, 400);
		
		//这里用到批次中一个最小的和一个最大的值来命名文件名 li[]
       // String zipFilename = path + list.get(0).getProjectInfo().getProjName()+"第"+li.get(0)+"批次到"+li.get(p.size()-1)+"批次的监督组监督工作情况及检测统计.zip";
		String zipFilename = Struts2Utils.getAppRootPath()+Constants.FILE_SEP+"temp"+Constants.FILE_SEP+projectId+Constants.FILE_SEP + currentDate+".zip";
		
        //打包文件路径
        String filepath = Struts2Utils.getAppRootPath()+"temp"+Constants.FILE_SEP+projectId+Constants.FILE_SEP + currentDate;
        String a  = "/temp/"+projectId+"/"+ currentDate+".zip";
        			//+list.get(0).getProjectInfo().getProjName()+"第"+li.get(0)+"批次到"+li.get(p.size()-1)+"批次的监督组监督工作情况及检测统计.zip";
        ZipHelper.getZipHelper().zip(filepath, zipFilename);
        Struts2Utils.sendRedirectUrl("/servlet/annex?path="+a);
        //UploadFile.downloadFileByInputStream(Struts2Utils.getRequest(), Struts2Utils.getResponse(), new File(zipFilename));

		}
	}

	
	public void prepareExcelOutProj() throws Exception {
		prepareModel();
	}
	
	/**
	 * 
	 * excelOutProj:
	 * 适用:全部工程，同一批次的导出
	 * @throws Exception 
	 * @exception 
	 * @since  1.0.0
	 */
	public void excelOutProj() throws Exception{
		
		//样板Excel
		String examplePath = Struts2Utils.getAppRootPath() + "\\resources\\jiandu.xls";
		QueryFilter filters = QueryFilter.buildFromHttpRequest(Struts2Utils
				.getRequest());
		filters.addFilter("batch",spotReport.getBatch());
		filters.addFilter("reportdate", DateUtils.convertStringToStrigulaDate(startTime),MatchType.GE);
		filters.addFilter("reportdate", DateUtils.convertStringToStrigulaDate(endTime),MatchType.LT);
		//list的到是该批次的全部记录
		List<SpotReport> list = detectManager.getSpotreportListByProperty(filters);
		//通过treeSet过滤工程的ID，treeSet它会自动按小到大的顺序排列
		TreeSet<String> p = new TreeSet<String>();
		for(int i = 0; i< list.size(); i ++){
			SpotReport spotReport = list.get(i);
			p.add(spotReport.getProjectInfo().getId());
		}
		
		List<SpotReport> listSpotReport = new ArrayList<SpotReport>();
		//iter中包含的是工程id
		Iterator<String> iter = p.iterator();
		while(iter.hasNext()){
			String prjId = iter.next();
			listSpotReport.add(detectManager.select(spotReport.getBatch(), prjId,startTime,endTime));
		}
		Long currentDate = System.currentTimeMillis();
		String title = "全部工程第"+spotReport.getBatch()+"批次的图形比较"; 
		String x = "监督抽检项目";
		String y = "项目合格百分比(%)";
		String path = Struts2Utils.getAppRootPath()+Constants.FILE_SEP+"temp"+Constants.FILE_SEP+projectId+Constants.FILE_SEP+"images"+Constants.FILE_SEP;
		(new File(path)).mkdirs();
		String imagePath  = Struts2Utils.getAppRootPath()+Constants.FILE_SEP+"temp/"+projectId+"/images/"+currentDate+"Propie.png";
		DefaultCategoryDataset dataset = new DefaultCategoryDataset();
		dataset = detectManager.CategoryDatasetExcelPro(dataset, listSpotReport);
		JFreeChart chart = JFreeChartUtils.createBarChart(dataset, title, x, y, false);
		JFreeChartUtils.drawToOutputStream(path+currentDate+"Propie.png", chart, 680, 400);
		ServletOutputStream responOut = Struts2Utils.getResponse().getOutputStream();
		WritableWorkbook wwb = detectManager.excelOutProj(listSpotReport,imagePath,responOut,examplePath);
		UploadFile.downloadExcelFile(wwb, Struts2Utils.getResponse(),
				"全部工程第" + spotReport.getBatch()+ "批次监督组监督工作情况及检测统计.xls");
	}
	
	/**
	 * 
	 * windows:
	 * 适用:
	 * @return
	 * @throws Exception 
	 * @exception 
	 * @since  1.0.0
	 */
	public String windows() throws Exception{
		DefaultCategoryDataset dataset = new DefaultCategoryDataset();	
		String title = "";
		String x = "监督抽检项目";
		String y = "项目合格百分比(%)";
		JFreeChart chart = null;
		page.setOrderBy("id");
		page.setOrder(Page.DESC);
		QueryFilter filters = new QueryFilter();
		if(StringUtils.isNotEmpty(id)){
			filters.addFilter("id", id, MatchType.EQ);
			List<SpotReport> list = detectManager.getSpotreportListByProperty(filters);
			page.setResult(list);
			dataset = detectManager.CategoryDataset(dataset, list.get(0).getBatch(), list);
			String signName = "";
			if(list.get(0).getSignid() != null){
				signName = "(标段为"+projectManager.getSign("id", list.get(0).getSignid()).getContractOrder()+")";
			}
			title = list.get(0).getProjectInfo().getProjName()+"工程第"+list.get(0).getBatch()+"批次"+ signName +"的图形比较"; 
			chart = JFreeChartUtils.createBarChart(dataset, title, x, y, false);
		}else{
		//得到的是某工程的全部批次或者該表中已有的全部批次
		List<String> li = detectManager.getSpotreportBatch(projectId,startTime,endTime);
			// 设置默认排序方式
			if(projectId != null && !projectId.equals("")){
				filters.addFilter("projectInfo.id", projectId, MatchType.EQ);
			}
			if(batch != null && !batch.equals("")){
				filters.addFilter("batch",batch, MatchType.EQ);
			}
			filters.addFilter("reportdate", DateUtils.convertStringToStrigulaDate(startTime),MatchType.GE);
			filters.addFilter("reportdate", DateUtils.convertStringToStrigulaDate(endTime),MatchType.LT);
			List<SpotReport> list = detectManager.getSpotreportListByProperty(filters);
			List<SpotReport> listSpotReport0 = new ArrayList<SpotReport>();
			if(projectId != null && !projectId.equals("")){
				if( batch == null || batch.equals("")){
					List<SpotReport> SpotReportlist = new ArrayList<SpotReport>();
					for(String batc : li){
						SpotReport e  = detectManager.select(batc, projectId,startTime,endTime);
						SpotReportlist.add(e);
					}
					page.setResult(SpotReportlist);
				}else{
					page = detectManager.getSpotreportList(page, filters);
				}
			}
			else if(projectId == null || projectId.equals("")){
						TreeSet<String> pId = new TreeSet<String>();
						for(int i = 0; i< list.size(); i ++){
							SpotReport spotReport = list.get(i);
							pId.add(spotReport.getProjectInfo().getId());
						}
						//pid中包含的是工程id
						Iterator<String> pid = pId.iterator();
						while(pid.hasNext()){
							String prjId = pid.next();
							Iterator<String> bat = li.iterator();
							SpotReport e1 ;
							if(StringUtils.isNotEmpty(batch)){
								 e1  = detectManager.select(batch, prjId,startTime,endTime);
								 if(e1 != null){
										listSpotReport0.add(e1);
									}
							}else{
								while(bat.hasNext()){
									String ba = bat.next();
									e1  = detectManager.select(ba, prjId,startTime,endTime);
									if(e1 != null){
										listSpotReport0.add(e1);
									}
								}
							}
						}
						page.setResult(listSpotReport0);
							}
			//同一工程不同批次
			if(projectId != null && !projectId.equals("")){
				if( batch == null || batch.equals("")){
					String projName = "";
					TreeSet<String> p = new TreeSet<String>();
					for(int i = 0; i< list.size(); i ++){
						SpotReport spotReport = list.get(i);
						p.add(spotReport.getBatch());
						projName = spotReport.getProjectInfo().getProjName();
					}
					//iter中包含的是批次
					Iterator<String> iter = p.iterator();
					while(iter.hasNext()){
					String nes  =  iter.next();
					QueryFilter filters1 = new QueryFilter();
						filters1.addFilter("projectInfo.id", projectId, MatchType.EQ);
						filters1.addFilter("batch",nes, MatchType.EQ);
						filters1.addFilter("reportdate", DateUtils.convertStringToStrigulaDate(startTime),MatchType.GE);
						filters1.addFilter("reportdate", DateUtils.convertStringToStrigulaDate(endTime),MatchType.LT);
						List<SpotReport> list1 = detectManager.getSpotreportListByProperty(filters1);
						dataset = detectManager.CategoryDataset(dataset, nes, list1);
						}
					title = projName+"工程不同批次的汇总图形比较"; 
					chart = JFreeChartUtils.createBarChart(dataset, title, x, y, false);
					}
				}
			if(projectId != null && !projectId.equals("") && batch != null && !batch.equals("")){
				dataset = detectManager.CategoryDatasetExcelOut(dataset, list);//同一工程同一批次
				ProjectInfo projectInfo = projectManager.getProj("id", projectId);
				title = projectInfo.getProjName()+"工程第"+batch+"批次的不同标段图形比较"; 
				chart = JFreeChartUtils.createBarChart(dataset, title, x, y, false);
				}
			if(projectId == null || projectId.equals("")){
					if(batch != null && !batch.equals("")){
						dataset = detectManager.CategoryDatasetExcelPro(dataset, listSpotReport0);//全部工程同一批次
						title = "全部工程第"+batch+"批次的图形比较"; 
						chart = JFreeChartUtils.createBarChart(dataset, title, x, y, false);
					}
					if(batch == null || batch.equals("")){
						return "windows";
					}
			}
		}
			jfreeChartBean.setTitle(title);
			jfreeChartBean.setWidth(980);
			jfreeChartBean.setHeight(400);
			String filename = ServletUtilities.saveChartAsPNG(chart, jfreeChartBean.getWidth(),
						jfreeChartBean.getHeight(), Struts2Utils.getRequest().getSession());
			Struts2Utils.getRequest().setAttribute("filename", filename);
		return "windows";
	}
	
	
	/**
	 * 
	 * batch:标段，批次的比较唯一性
	 * 适用:
	 * @throws Exception 
	 * @exception 
	 * @since  1.0.0
	 */
	public void batch()throws Exception{
		String oldBatch = Struts2Utils.getParameter("oldBatch");
		String oldSignid = Struts2Utils.getParameter("oldSignid");
		String signid = Struts2Utils.getParameter("signid");
		if(detectManager.batch(batch,signid,oldBatch,oldSignid,projectId)){
			Struts2Utils.renderText("0");
		}else {
			Struts2Utils.renderText("1");
		}
	}
	
	public String projwin() throws Exception{
		QueryFilter queryfilter = new QueryFilter();
		if (!page1.isOrderBySetted()) {
			page1.setOrderBy("createDate");
			page1.setOrder(Page.DESC);
		}
		//获取当前登录用户
//		user = SpringSecurityUtils.getCurrentUser();
//		if(null != user){
//			queryfilter.addFilter("orgCode.id", user.getOrganization().getId());
//		}
		page1 = projectManager.getPageProj(page1, queryfilter);
		return "projwin";
	}
	
	/**
	 * 
	 * excelTownship:
	 * 适用:查看镇区，公路等级，行政级别
	 * @return 
	 * @throws Exception 
	 * @exception 
	 * @since  1.0.0
	 */
	public String excelTownship() throws Exception{
		
		//获取从页面中得到的数据
		String type =  Struts2Utils.getParameter("type");
//		String towns = Struts2Utils.getParameter("townItems");
//		String roads = Struts2Utils.getParameter("roadItems");
//		String leves = Struts2Utils.getParameter("levelItems");
		//按条件查找全部符合条件的数据
		System.out.println(startTime+endTime);
		List<SpotReport>  listAll = detectManager.three(type,planTypes,startTime,endTime,townItems,roadItems,levelItems);
		
		//设置一个类型为set的Date,是为了得到提交的时间
		TreeSet<Date> datelist = new TreeSet<Date>();
		//柱状图
		DefaultCategoryDataset dataset = new DefaultCategoryDataset();	
		String title = "";
		String x = "监督抽检项目";
		String y = "项目合格百分比(%)";
		JFreeChart chart = null;
		if(type != null && type.equals("level")){
			title = "行政级别之间的数据比较";}
		if(type != null && type.equals("road")){
			title = "公路等级之间的数据比较";}
		if(type != null && type.equals("town")){
			title = "镇区之间的数据比较";}
		List<SpotReportVo> list = detectManager.unquitList(listAll, type, title,datelist);
		
		/** 该段代码是为了得到满足以上条件的数据中的提交的最小和最大时间，如果页面中穿来了时间，那就以页面中的时间优先*/
		List<String> sdate = new ArrayList<String>();
		if(!datelist.isEmpty()){
		for(Date d : datelist){
			sdate.add(DateUtils.convertDateToString(d));
		}
		if(startTime == null || startTime.equals("")){
			setStartTime(sdate.get(0));}
		if(endTime == null || endTime.equals("")){
			setEndTime(sdate.get(sdate.size()-1));}
		}
		/**/
		
		dataset = detectManager.CategoryDataset(dataset,list);
		chart = JFreeChartUtils.createBarChart(dataset, title, x, y, false);
		jfreeChartBean.setTitle(title);
		jfreeChartBean.setWidth(980);
		jfreeChartBean.setHeight(400);
		String filename = ServletUtilities.saveChartAsPNG(chart, jfreeChartBean.getWidth(),
					jfreeChartBean.getHeight(), Struts2Utils.getRequest().getSession());
		Struts2Utils.getRequest().setAttribute("title",title);
		Struts2Utils.getRequest().setAttribute("filename", filename);
		Struts2Utils.getRequest().setAttribute("spotReportVoList", list);
		Struts2Utils.getRequest().setAttribute("type", type);
		return "winTownship";
	}
	
	/**
	 * 
	 * excelThree:
	 * 适用:导出镇区，公路等级，行政级别
	 * @throws Exception 
	 * @exception 
	 * @since  1.0.0
	 */
	public void excelThree()throws Exception{
			
			String type =  Struts2Utils.getParameter("type");
			//按条件查找全部符合条件的数据
			List<SpotReport>  listAll = detectManager.three(type,planTypes,startTime,endTime,townItems,roadItems,levelItems);
			Map<String, List<SpotReport>> p = new HashMap<String, List<SpotReport>>();
			for(int i = 0 ; i< listAll.size() ; i++){
				String projectId = listAll.get(i).getProjectInfo().getId();
				if(!p.containsKey(projectId)){
					List<SpotReport> p2p = new ArrayList<SpotReport>();
					p2p.add(listAll.get(i));
					p.put(projectId,p2p);
				}else{
					p.get(projectId).add(listAll.get(i));
				}
			}
			String title = "";
			String x = "监督抽检项目";
			String y = "项目合格百分比(%)";
			if(type != null && type.equals("level")){
				title = "行政级别之间的数据比较";}
			if(type != null && type.equals("road")){
				title = "公路等级之间的数据比较";}
			if(type != null && type.equals("town")){
				title = "镇区之间的数据比较";}
			
			//设置一个类型为set的Date,是为了得到提交的时间
			TreeSet<Date> datelist = new TreeSet<Date>();
			List<SpotReportVo> list = detectManager.unquitList(listAll, type, title,datelist);
			
			List<SpotReport> spotReportList = new ArrayList<SpotReport>();
			for(Entry<String, List<SpotReport>> entry: p.entrySet()) {  
				 List<SpotReport> list11 =  entry.getValue();
				 detectManager.totle(list11,type,list11.get(0).getProjectInfo().getProjName(),null,datelist);
				 SpotReport e  = detectManager.select("", entry.getKey(),startTime,endTime);
				 spotReportList.add(e);
			} 
			
			//样板Excel
			String examplePath = Struts2Utils.getAppRootPath() + "\\resources\\zongjiandu.xls";
			ServletOutputStream responOut = Struts2Utils.getResponse().getOutputStream();
			Long currentDate = System.currentTimeMillis();
			String path = Struts2Utils.getAppRootPath()+Constants.FILE_SEP+"temp"+Constants.FILE_SEP+projectId+Constants.FILE_SEP+"images"+Constants.FILE_SEP;
			(new File(path)).mkdirs();
			String imagePath  = Struts2Utils.getAppRootPath()+Constants.FILE_SEP+"temp/"+projectId+"/images/"+currentDate+"Propie.png";
			DefaultCategoryDataset dataset = new DefaultCategoryDataset();
			
			dataset = detectManager.CategoryDataset(dataset, list);
			JFreeChart chart = JFreeChartUtils.createBarChart(dataset, title, x, y, false);
			JFreeChartUtils.drawToOutputStream(path+currentDate+"Propie.png", chart, 680, 400);
			WritableWorkbook wwb = detectManager.excelThree(spotReportList,list, imagePath, responOut, examplePath);
			UploadFile.downloadExcelFile(wwb, Struts2Utils.getResponse(),"工程监督组监督工作情况及检测统计.xls");
	}
	
	public String zhenquTime() throws Exception{
		return "zhenquTime";
	}
	public String modk() throws Exception{
		System.out.println(startTime+ endTime);
		//样板Excel
		String examplePath = Struts2Utils.getAppRootPath() + "\\resources\\zongji.xls";
		ServletOutputStream responOut = Struts2Utils.getResponse().getOutputStream();
		Map<String, SpotReport> pp = detectManager.hebing(startTime, endTime);
		WritableWorkbook wwb = detectManager.excelZongji(pp,responOut,examplePath);
		UploadFile.downloadExcelFile(wwb, Struts2Utils.getResponse(),
				"全部工程监督组监督工作情况及检测统计数据.xls");
		System.out.println("=================="+startTime+ endTime);
		return null;
	}
	
	public String time() throws Exception{
		return "time";
	}
	
	public String guanjian() throws Exception{
		return "guanjian";
	}
	
	public String zhibiaozx() throws Exception{
		jfreeChartBean.setWidth(980);
		jfreeChartBean.setHeight(400);
		Date date = new Date();
		if(StringUtils.isEmpty(yearTime)){
			yearTime = DateUtils.getYearNum(date) + "";
		}
		if(StringUtils.isEmpty(yearTime2)){
			yearTime2 = (DateUtils.getYearNum(date)+1) + "";
		}
		
		String type =  Struts2Utils.getParameter("type");
		String title = "";
		String x = "监督抽检项目";
		String y = "项目合格百分比(%)";
		this.stringToArray();
		if(StringUtils.equals(type, "town")){
			title = "镇区指标的数据比较";
			String groupBy = "u.spotReport.projectInfo.atTown";
			zxTownLevelRoad(title, x, y, townItems, 4419, groupBy);
		}else if(StringUtils.equals(type,"level")){
				title = "行政指标之间的数据比较";
				String groupBy = "u.spotReport.projectInfo.socialLevel";
				zxTownLevelRoad(title, x, y, levelItems, 3108, groupBy);
		}else if(StringUtils.equals(type,"road")){
				title = "公路指标之间的数据比较";
				String groupBy = "u.spotReport.projectInfo.techGrade";
				zxTownLevelRoad(title, x, y, roadItems, 3006, groupBy);
		}else if(StringUtils.equals(type,"jidu")){
				jiduzx(title, x, y, type);
		}else if(StringUtils.equals(type,"month")){
				jiduzx(title, x, y, type);
		}else if(StringUtils.equals(type,"year")){
				jiduzx(title, x, y, type);
		}
		Struts2Utils.getRequest().setAttribute("type", type);
		return "zhibiaozx";
	}
	
	public void jiduzx(String title, String x, String y,String type) throws Exception{
		List<SpotReport> spotReportList = new ArrayList<SpotReport>();
		List<String> ro = new ArrayList<String>();
		List<String> se = new ArrayList<String>();
		Map<String,SpotReport> spotReportListTownMapCn = new HashMap<String, SpotReport>();
		DefaultCategoryDataset dataset = new DefaultCategoryDataset();
		String townit = "";
		if(type.equals("jidu")){
			Map<String ,String> timemap = timesu();
			for(String jid : timemap.keySet()){
				String tiall = timemap.get(jid);
				String i = tiall.substring(tiall.indexOf("+")+1);
				String yetime = tiall.substring(0,tiall.indexOf("+"));
				SpotReport spotReport = new SpotReport();
				String startTime1 = detectManager.jiduTotimeS(i, yetime);
				String endTime2 = detectManager.jiduTotimeE(i, yetime);
				spotReport = detectManager.jiduTong(startTime1,endTime2,planTypes,townItems,roadItems,levelItems);
				spotReport.setReplace(jid);
				spotReportList.add(spotReport);
				ro.add(jid);
				se.add(i+"");
				spotReportListTownMapCn.put(jid, spotReport);
				townit += jid + ",";
			}
			String jiduS = startJidu.substring(4);
			String jiduE = endJidu.substring(4);
			title = yearTime+"年第"+jiduS+"季度到"+yearTime2+"年第"+jiduE+"季度的数据比较";
		}else if(type.equals("month")){
			Map<String ,String> timemap = month();
			for(String jid : timemap.keySet()){
				String tiall = timemap.get(jid);
				String i = tiall.substring(tiall.indexOf("+")+1);
				String yetime = tiall.substring(0,tiall.indexOf("+"));
				SpotReport spotReport = new SpotReport();
				String startTime1 = detectManager.jiduTotimeMonthS(i, yetime);
				String endTime2 = detectManager.jiduTotimeMonthE(i, yetime);
				spotReport = detectManager.jiduTong(startTime1,endTime2,planTypes,townItems,roadItems,levelItems);
				spotReport.setReplace(jid);
				spotReportList.add(spotReport);
				ro.add(jid);
				se.add(i+"");
				spotReportListTownMapCn.put(jid, spotReport);
				townit += jid + ",";
			}
			int smYear = Integer.parseInt(startMonth.substring(0, startMonth.indexOf("-")));
			int emYear = Integer.parseInt(endMonth.substring(0, endMonth.indexOf("-")));
			int smonth = Integer.parseInt(startMonth.substring(startMonth.indexOf("-")+1));
			int emonth = Integer.parseInt(endMonth.substring(endMonth.indexOf("-")+1));
			title = smYear+"年第"+smonth+"月到"+emYear+"年第"+emonth+"月的数据比较";
	}else if(type.equals("year")){
		Map<String ,String> timemap = year();
		for(String jid : timemap.keySet()){
			String tiall = timemap.get(jid);
			SpotReport spotReport = new SpotReport();
			String startTime1 = detectManager.jiduTotimeYearS(tiall);
			String endTime2 = detectManager.jiduTotimeYearE(tiall);
			spotReport = detectManager.jiduTong(startTime1,endTime2,planTypes,townItems,roadItems,levelItems);
			spotReport.setReplace(jid);
			spotReportList.add(spotReport);
			ro.add(jid);
			//se.add(i+"");
			spotReportListTownMapCn.put(jid, spotReport);
			townit += jid + ",";
		}
		
		title = startYear+"年到"+endYear+"年的数据比较";
}
		String tab = "";
		String content = "";
		for (int i = 0; i < ro.size(); i++) {
			tab += "<th colspan='3'>" + ro.get(i) + "</th>";
		}
		tab += "</tr>"; 
		content = detectManager.liuZuhe(ro, spotReportList, spotReportListTownMapCn, luji, lumian, qiaoliang, suidao, safe, cailiao, alltotal);
		Struts2Utils.getRequest().setAttribute("content", content);
		Struts2Utils.getRequest().setAttribute("tab", tab);
		
		jfreeChartBean.setTitle(title);
		dataset = detectManager.CategoryDatasetThree(dataset, spotReportListTownMapCn, townit, 555, luji, lumian, qiaoliang, suidao, safe, cailiao, alltotal);
		JFreeChart chart = JFreeChartUtils.createBarChart(dataset, title, x, y, false);
		String filename = ServletUtilities.saveChartAsPNG(chart, jfreeChartBean.getWidth(),
				jfreeChartBean.getHeight(), Struts2Utils.getRequest().getSession());
		Struts2Utils.getRequest().setAttribute("title",title);
		Struts2Utils.getRequest().setAttribute("filename", filename);
		Struts2Utils.getRequest().setAttribute("spotReportAllList", spotReportList);
	}
	
	public void zxTownLevelRoad(String title,String x,String y,String tongjiType, int daihao,String groupBy) throws Exception{
		
		kaishi = startTime + "至" +endTime;;
		title = kaishi + title;
		Map<String, SpotReport> spotReportListTownMap = new HashMap<String,SpotReport>();
		spotReportListTownMap = detectManager.jiduTownOrLevel(startTime,endTime,"",groupBy,planTypes,townItems,roadItems,levelItems);
		List<SpotReport> spotReportTownList = new ArrayList<SpotReport>();
		//spotReportListTownMap与spotReportListTownMapCn的区别是key的不同，前面一个是编码，后一个key已经转化成对应的中文
		Map<String, SpotReport> spotReportListTownMapCn = new HashMap<String,SpotReport>();
		
		List<String> ro = detectManager.toto(tongjiType,daihao);
		List<String> roto = new ArrayList<String>();
		String townit = "";
		for(String dataKey : spotReportListTownMap.keySet())   
		{   
			SpotReport report = new SpotReport();
			report = spotReportListTownMap.get(dataKey);
			report.setReplace(LabelHelper.getInstance().buildCodeName(daihao,dataKey));
			spotReportTownList.add(report);
			spotReportListTownMapCn.put(LabelHelper.getInstance().buildCodeName(daihao,dataKey),report);
			roto.add(LabelHelper.getInstance().buildCodeName(daihao,dataKey));
			townit += dataKey +",";
		}
		if(StringUtils.isNotEmpty(tongjiType)){
			townit = tongjiType;
		}
		if(ro.size() == 0){
			ro = roto;
		}
		String tab = "";
		String content = "";
		for (int i = 0; i < ro.size(); i++) {
			tab += "<th colspan='3'>" + ro.get(i) + "</th>";
		}
		tab += "</tr>"; 
		content = detectManager.liuZuhe(ro, spotReportTownList, spotReportListTownMapCn, luji, lumian, qiaoliang, suidao, safe, cailiao, alltotal);
		Struts2Utils.getRequest().setAttribute("content", content);
		Struts2Utils.getRequest().setAttribute("tab", tab);
		jfreeChartBean.setTitle(title);
		DefaultCategoryDataset dataset = new DefaultCategoryDataset();
		dataset = detectManager.CategoryDatasetThree(dataset, spotReportListTownMap,townit,daihao,luji,lumian,qiaoliang,suidao,safe,cailiao,alltotal);
		JFreeChart chart = JFreeChartUtils.createBarChart(dataset, title, x, y, false);
		String filename = ServletUtilities.saveChartAsPNG(chart, jfreeChartBean.getWidth(),
				jfreeChartBean.getHeight(), Struts2Utils.getRequest().getSession());
		Struts2Utils.getRequest().setAttribute("filename", filename);
		Struts2Utils.getRequest().setAttribute("spotReportAllList", ro);
	}
	
	public void juproj(String title) throws Exception{
		String jiduS = startJidu.substring(4);
		String jiduE = endJidu.substring(4);
		List<String> se = new ArrayList<String>();
		List<SpotReport> spotReportListAll = new ArrayList<SpotReport>();
		Map<String, SpotReport> spotReportListMapAll = new HashMap<String,SpotReport>();
		Map<String,Map<String,SpotReport>> mapspotall = new LinkedHashMap<String, Map<String,SpotReport>>();
		Map<String ,String> timemap = timesu();
		for(String jid : timemap.keySet()){
			String tiall = timemap.get(jid);
			String i = tiall.substring(tiall.indexOf("+")+1);
			String yetime = tiall.substring(0,tiall.indexOf("+"));
			String startTime1 = detectManager.jiduTotimeS(i, yetime);
			String endTime2 = detectManager.jiduTotimeE(i, yetime);
			Map<String, SpotReport> spotReportListMap = new HashMap<String,SpotReport>();
			spotReportListMap = detectManager.jiduProjTong(startTime1,endTime2,jid,planTypes,townItems,roadItems,levelItems);
			spotReportListMapAll.putAll(spotReportListMap);
			mapspotall.put(jid, spotReportListMap);
			se.add(i+"");
		}
		title = yearTime+"年第"+jiduS+"季度到"+yearTime2+"年第"+jiduE+"季度的数据比较";
		List<SpotReport> spotReportAllList = new ArrayList<SpotReport>();
		for(String mapall : spotReportListMapAll.keySet())   
		{   
			ProjectInfo projectInfo0 = projectManager.getProj("id", mapall);
			for(String map : mapspotall.keySet()){
				Map<String,SpotReport> spotReportListMap = mapspotall.get(map);
				if(!spotReportListMap.containsKey(mapall)){
					SpotReport report =  new SpotReport();
					report.setProjectInfo(projectInfo0);
					report.setReplace(map);
					mapspotall.get(map).put(mapall, report);
					spotReportListAll.add(report);
				}else{
					mapspotall.get(map).get(mapall).setProjectInfo(projectInfo0);
					spotReportListAll.add(mapspotall.get(map).get(mapall));
				}
			}
			spotReportAllList.add(spotReportListMapAll.get(mapall));
		}
		String content = "";
		for(String mapss : mapspotall.keySet()){
			content += detectManager.conZuhe(mapss, spotReportAllList, mapspotall.get(mapss));
			
		}
		Struts2Utils.getRequest().setAttribute("content", content);
		
		String x = "监督抽检项目";
		String y = "项目合格百分比(%)";
		jfreeChartBean.setTitle(title);
		jfreeChartBean.setWidth(980);
		jfreeChartBean.setHeight(400);
		DefaultCategoryDataset dataset = new DefaultCategoryDataset();
		dataset = detectManager.CategoryDatasetProj(dataset, spotReportListAll);
		JFreeChart chart = JFreeChartUtils.createBarChart(dataset, title, x, y, false);
		String filename = ServletUtilities.saveChartAsPNG(chart, jfreeChartBean.getWidth(),
				jfreeChartBean.getHeight(), Struts2Utils.getRequest().getSession());
		Struts2Utils.getRequest().setAttribute("title",title);
		Struts2Utils.getRequest().setAttribute("filename", filename);
		Struts2Utils.getRequest().setAttribute("spotReportAllList", spotReportAllList);
		
	}
	
	public String projzhibiao() throws Exception{
		Date date = new Date();
		if(StringUtils.isEmpty(yearTime)){
			yearTime = DateUtils.getYearNum(date) + "";
		}
		if(StringUtils.isEmpty(yearTime2)){
			yearTime2 = (DateUtils.getYearNum(date)+1) + "";
		}
		if(StringUtils.isEmpty(zbyearTime)){
			zbyearTime = DateUtils.getYearNum(date) + "";
		}
		String type =  Struts2Utils.getParameter("type");
		String title = "";
		if(StringUtils.equals(type, "jidu")){
			juproj(title);

		}else if(StringUtils.equals(type, "zhibiao")){
			
			this.stringToArray();
			//以下是季度zbJidu
			String zbjidu = zbJidu.substring(4);
			//某一年的第某个季度的开始和结束时间
			
			String startZbJidu1 = detectManager.jiduTotimeS(zbjidu, zbyearTime);
			String startZbJidu2 = detectManager.jiduTotimeE(zbjidu, zbyearTime);
			String jizb = zbyearTime+"年第"+zbjidu+"季度";
			kaishi = jizb;
			Map<String, SpotReport> spotReportListZbMap = new HashMap<String,SpotReport>();
			spotReportListZbMap = detectManager.jiduProjTong(startZbJidu1,startZbJidu2,jizb,planTypes,townItems,roadItems,levelItems);
			List<SpotReport> spotReportZbList = new ArrayList<SpotReport>();
			for(String dataKey : spotReportListZbMap.keySet())   
			{   
				ProjectInfo projectInfo = projectManager.getProj("id", dataKey);
				spotReportListZbMap.get(dataKey).setProjectInfo(projectInfo);
				spotReportZbList.add(spotReportListZbMap.get(dataKey));
			}
			String tab = "";
			for (int i = 0; i < spotReportZbList.size(); i++) {
				SpotReport spotReportZb = spotReportZbList.get(i);
				tab += "<th colspan='3'>" + spotReportZb.getProjectInfo().getProjName() + "</th>";
			}
			String content = "";
			content = detectManager.liuZuheZhibiao(spotReportZbList, luji, lumian, qiaoliang, suidao, safe, cailiao);
			Struts2Utils.getRequest().setAttribute("content", content);
			Struts2Utils.getRequest().setAttribute("tab", tab);
			
			title = jizb + "各个工程指标的比较";
			String x = "监督抽检项目";
			String y = "项目合格百分比(%)";
			jfreeChartBean.setTitle(title);
			jfreeChartBean.setWidth(980);
			jfreeChartBean.setHeight(400);
			DefaultCategoryDataset dataset = new DefaultCategoryDataset();
			dataset = detectManager.CategoryDatasetZhiBiao(dataset, spotReportZbList,luji,lumian,qiaoliang,suidao,safe,cailiao);
			JFreeChart chart = JFreeChartUtils.createBarChart(dataset, title, x, y, false);
			String filename = ServletUtilities.saveChartAsPNG(chart, jfreeChartBean.getWidth(),
					jfreeChartBean.getHeight(), Struts2Utils.getRequest().getSession());
			Struts2Utils.getRequest().setAttribute("filename", filename);
			Struts2Utils.getRequest().setAttribute("spotReportAllList", spotReportZbList);
			Struts2Utils.getRequest().setAttribute("title",title);
		}
		Struts2Utils.getRequest().setAttribute("type", type);
		return "projzhibiao";
	}
	
	/**
	 * 
	 * stringToArray:
	 * 适用: 将带,的字符串变成数组
	 * @exception 
	 * @since  1.0.0
	 */
	public void stringToArray(){
		if(StringUtils.isNotEmpty(lujiString)){
			luji = lujiString.split(",");
		}
		if(StringUtils.isNotEmpty(lumianString)){
			lumian = lumianString.split(",");
		}
		if(StringUtils.isNotEmpty(qiaoliangString)){
			qiaoliang = qiaoliangString.split(",");
		}
		if(StringUtils.isNotEmpty(suidaoString)){
			suidao = suidaoString.split(",");
		}
		if(StringUtils.isNotEmpty(safeString)){
			safe = safeString.split(",");
		}
		if(StringUtils.isNotEmpty(cailiaoString)){
			cailiao = cailiaoString.split(",");
		}
	}
	
	public String zhibiaohx() throws Exception{
		Date date = new Date();
		if(StringUtils.isEmpty(yearTime)){
			yearTime = DateUtils.getYearNum(date) + "";
		}
		if(StringUtils.isEmpty(yearTime2)){
			yearTime2 = (DateUtils.getYearNum(date)+1) + "";
		}
		String type =  Struts2Utils.getParameter("type");
		this.stringToArray();
		String title = "";
		String x = "监督抽检项目";
		String y = "项目合格百分比(%)";
		this.stringToArray();
		jfreeChartBean.setTitle(title);
		jfreeChartBean.setWidth(980);
		jfreeChartBean.setHeight(400);
		if(StringUtils.equals(type, "town")){
			title = "镇区之间的数据比较";
			String groupBy = "u.spotReport.projectInfo.atTown";
			hxTownLevelRoad(title, x, y, townItems, 4419, groupBy);
		}else 
			if(StringUtils.equals(type,"level")){
				title = "行政级别之间的数据比较";
				String groupBy = "u.spotReport.projectInfo.socialLevel";
				hxTownLevelRoad(title, x, y, levelItems, 3108, groupBy);
		}else 
			if(StringUtils.equals(type,"road")){
				title = "公路等级之间的数据比较";
				String groupBy = "u.spotReport.projectInfo.techGrade";
				hxTownLevelRoad(title, x, y, roadItems, 3006, groupBy);
			}
		else
			if(StringUtils.equals(type, "jidu")){
				jiduhx(title, x, y, type);
		}
		else
			if(StringUtils.equals(type, "month")){
				jiduhx(title, x, y, type);
			}
		else
			if(StringUtils.equals(type, "year")){
				jiduhx(title, x, y, type);
			}
		Struts2Utils.getRequest().setAttribute("type", type);
		return "zhibiaohx";
	}
	
	public void jiduhx(String title, String x, String y, String type)throws Exception{
		List<SpotReport> spotReportList = new ArrayList<SpotReport>();
		List<String> ro = new ArrayList<String>();
		List<String> se = new ArrayList<String>();
		Map<String,SpotReport> spotReportListTownMapCn = new HashMap<String, SpotReport>();
		DefaultCategoryDataset dataset = new DefaultCategoryDataset();
		if(type.equals("jidu")){
			Map<String ,String> timemap = timesu();
			for(String jid : timemap.keySet()){
				String tiall = timemap.get(jid);
				String i = tiall.substring(tiall.indexOf("+")+1);
				String yetime = tiall.substring(0,tiall.indexOf("+"));
				SpotReport spotReport = new SpotReport();
				String startTime1 = detectManager.jiduTotimeS(i, yetime);
				String endTime2 = detectManager.jiduTotimeE(i, yetime);
				spotReport = detectManager.jiduTong(startTime1,endTime2,planTypes,townItems,roadItems,levelItems);
				spotReport.setReplace(jid);
				spotReportList.add(spotReport);
				ro.add(jid);
				se.add(i);
				spotReportListTownMapCn.put(jid, spotReport);
			}
			//以下是季度jiduS和季度jiduE的数据比较
			String jiduS = startJidu.substring(4);
			String jiduE = endJidu.substring(4);
			title = yearTime+"年第"+jiduS+"季度到"+yearTime2+"年第"+jiduE+"季度的数据比较";
		}else if(type.equals("month")){
			Map<String ,String> timemap = month();
				for(String jid : timemap.keySet()){
					String tiall = timemap.get(jid);
					String i = tiall.substring(tiall.indexOf("+")+1);
					String yetime = tiall.substring(0,tiall.indexOf("+"));
					SpotReport spotReport = new SpotReport();
					String startTime1 = detectManager.jiduTotimeMonthS(i, yetime);
					String endTime2 = detectManager.jiduTotimeMonthE(i, yetime);
					spotReport = detectManager.jiduTong(startTime1,endTime2,planTypes,townItems,roadItems,levelItems);
					spotReport.setReplace(jid);
					spotReportList.add(spotReport);
					ro.add(jid);
					se.add(i);
					spotReportListTownMapCn.put(jid, spotReport);
				}
			int smYear = Integer.parseInt(startMonth.substring(0, startMonth.indexOf("-")));
			int emYear = Integer.parseInt(endMonth.substring(0, endMonth.indexOf("-")));
			int smonth = Integer.parseInt(startMonth.substring(startMonth.indexOf("-")+1));
			int emonth = Integer.parseInt(endMonth.substring(endMonth.indexOf("-")+1));
			title = smYear+"年第"+smonth+"月到"+emYear+"年第"+emonth+"月的数据比较";
		}else if(type.equals("year")){
			Map<String ,String> timemap = year();
			for(String jid : timemap.keySet()){
				String tiall = timemap.get(jid);
				SpotReport spotReport = new SpotReport();
				String startTime1 = detectManager.jiduTotimeYearS(tiall);
				String endTime2 = detectManager.jiduTotimeYearE(tiall);
				spotReport = detectManager.jiduTong(startTime1,endTime2,planTypes,townItems,roadItems,levelItems);
				spotReport.setReplace(jid);
				spotReportList.add(spotReport);
				ro.add(jid);
//				se.add(i);
				spotReportListTownMapCn.put(jid, spotReport);
			}
			title = startYear+"年到"+endYear+"年的数据比较";
	}
		jfreeChartBean.setTitle(title);
		dataset = detectManager.CategoryDatasetHx(dataset, spotReportList,luji,lumian,qiaoliang,suidao,safe,cailiao,alltotal);
		JFreeChart chart = JFreeChartUtils.createBarChart(dataset, title, x, y, false);
		String filename = ServletUtilities.saveChartAsPNG(chart, jfreeChartBean.getWidth(),
				jfreeChartBean.getHeight(), Struts2Utils.getRequest().getSession());
		Struts2Utils.getRequest().setAttribute("title",title);
		Struts2Utils.getRequest().setAttribute("filename", filename);
		Struts2Utils.getRequest().setAttribute("spotReportList", spotReportList);
		String content = "";
		content = detectManager.zhibiaohengxiang(ro, spotReportListTownMapCn, luji, lumian, qiaoliang, suidao, safe, cailiao, alltotal);
		Struts2Utils.getRequest().setAttribute("content", content);
		
	}
	
	public Map<String, String> timesu() throws Exception{
		int num = Integer.parseInt(yearTime2) - Integer.parseInt(yearTime);
		int ky = Integer.parseInt(yearTime);
		int kd = Integer.parseInt(startJidu.substring(4));
		int ed = Integer.parseInt(endJidu.substring(4));
		int l = num*4-kd+1+ed;
		int s = 0;
		int year = 0;
		Map<String,String> timeMap = new LinkedHashMap<String, String>();
		for (int i = 0; i < l; i++) {
			s = i + kd;
			s = s - year * 4;
			if(s>4){
				year++;
				s = s-4;
				if(s==0)s=4;
				ky ++;
			}
			timeMap.put(ky+"年"+"第"+s+"季度", ky+"+"+s);
			System.out.println(ky+"0"+s);
		}
		return timeMap;
	}
	
	public Map<String, String> month() throws Exception{
		int smYear = Integer.parseInt(startMonth.substring(0, startMonth.indexOf("-")));
		int emYear = Integer.parseInt(endMonth.substring(0, endMonth.indexOf("-")));
		int smonth = Integer.parseInt(startMonth.substring(startMonth.indexOf("-")+1));
		int emonth = Integer.parseInt(endMonth.substring(endMonth.indexOf("-")+1));
		int num = emYear - smYear;
		int l = num*12-smonth+1+emonth;
		int s = 0;
		int year = 0;
		Map<String,String> timeMap = new LinkedHashMap<String, String>();
		for (int i = 0; i < l; i++) {
			s = i + smonth;
			s = s - year * 12;
			if(s>12){
				year++;
				s = s-12;
				if(s==0)s=12;
				smYear ++;
			}
			timeMap.put(smYear+"年"+"第"+s+"月", smYear+"+"+s);
			System.out.println(smYear+" "+s);
		}
		return timeMap;
	}
	
	public Map<String, String> year() throws Exception{
		int smYear = Integer.parseInt(startYear);
		int emYear = Integer.parseInt(endYear);
//		int num = emYear - smYear;
		Map<String,String> timeMap = new LinkedHashMap<String, String>();
		for (int i = smYear; i <= emYear; i++) {
			timeMap.put(i+"年", i+"");
			System.out.println(i);
		}
		return timeMap;
	}
	
	public void hxTownLevelRoad(String title,String x,String y,String tongjiType, int daihao,String groupBy) throws Exception{
		kaishi = startTime + "至" +endTime;
		Map<String, SpotReport> spotReportListTownMap = new HashMap<String,SpotReport>();
		spotReportListTownMap = detectManager.tongByTownOrLevelOrRoad(startTime,endTime,"",groupBy,planTypes,townItems,roadItems,levelItems);
		List<SpotReport> spotReportTownOrLevelOrRoadList = new ArrayList<SpotReport>();
		//spotReportListTownMap与spotReportListTownMapCn的区别是key的不同，前面一个是编码，后一个key已经转化成对应的中文
		Map<String, SpotReport> spotReportListTownMapCn = new HashMap<String,SpotReport>();
		List<String> ro = detectManager.toto(tongjiType,daihao);
		List<String> roto = new ArrayList<String>();
		String townit = "";
		for(String dataKey : spotReportListTownMap.keySet())   
		{   
			SpotReport report = new SpotReport();
			report = spotReportListTownMap.get(dataKey);
			report.setReplace(LabelHelper.getInstance().buildCodeName(daihao,dataKey));
			spotReportTownOrLevelOrRoadList.add(report);
			spotReportListTownMapCn.put(LabelHelper.getInstance().buildCodeName(daihao,dataKey),report);
			roto.add(LabelHelper.getInstance().buildCodeName(daihao,dataKey));
			townit += dataKey +",";
		}
		if(StringUtils.isNotEmpty(tongjiType)){
			townit = tongjiType;
		}
		if(ro.size() == 0){
			ro = roto;
		}
		String content = "";
		content = detectManager.zhibiaohengxiang(ro, spotReportListTownMapCn, luji, lumian, qiaoliang, suidao, safe, cailiao, alltotal);
		Struts2Utils.getRequest().setAttribute("content", content);
		DefaultCategoryDataset dataset = new DefaultCategoryDataset();	
		
		JFreeChart chart = null;
		dataset = detectManager.CategoryDatasetTownPici(dataset,spotReportListTownMap,townit,daihao,luji,lumian,qiaoliang,suidao,safe,cailiao,alltotal);
		chart = JFreeChartUtils.createBarChart(dataset, title, x, y, false);
		String filename = ServletUtilities.saveChartAsPNG(chart, jfreeChartBean.getWidth(),
					jfreeChartBean.getHeight(), Struts2Utils.getRequest().getSession());
		Struts2Utils.getRequest().setAttribute("title",title);
		Struts2Utils.getRequest().setAttribute("filename", filename);
		Struts2Utils.getRequest().setAttribute("spotReportList", spotReportTownOrLevelOrRoadList);
	}
	
	
	/**
	 * 
	 * jidu:
	 * 适用:
	 * @param jiduS
	 * @return 返回的是某一年某一个季度的数据条数
	 * @exception 
	 * @since  1.0.0
	 */
	public List<SpotReport> jidu(String jiduS){
		String startJidu1 = detectManager.jiduTotimeS(jiduS, yearTime);
		String startJidu2 = detectManager.jiduTotimeE(jiduS, yearTime);
		QueryFilter filters = QueryFilter.buildFromHttpRequest(Struts2Utils
				.getRequest());
		filters.addFilter("reportdate",DateUtils.convertStringToStrigulaDate(startJidu1), MatchType.GE);
		filters.addFilter("reportdate",DateUtils.convertStringToStrigulaDate(startJidu2), MatchType.LT);
		List<SpotReport> list = detectManager.getSpotreportListByProperty(filters);
		return list;
	}

	
	public String test() throws Exception{
		QueryFilter filters = QueryFilter.buildFromHttpRequest(Struts2Utils
				.getRequest());
		// 设置默认排序方式
		if (!page.isOrderBySetted()) {
			page.setOrderBy("createDate");
			page.setOrder(Page.DESC);
		}
		page = detectManager.getSpotreportList(page, filters);
		return "test";
	}
	
	public String view() throws Exception{
		return "view";
	}
	
	public String condition() throws Exception{
		return "condition";
	}
	public void prepareView()throws Exception {
		spotReport = detectManager.viewByProject(startTime,endTime,biaoduan,projectId);
	}
	
	public Page<ProjectInfo> getPage1() {
		return page1;
	}

	public void setPage1(Page<ProjectInfo> page1) {
		this.page1 = page1;
	}

	public void prepareBatch() throws Exception{
		prepareModel();
	}
	@Override
	protected void prepareModel() throws Exception {
		if (StringUtils.isNotEmpty(id)) {
			spotReport = detectManager.findSpotReportByBIproperty("id", id);
		} else {
			spotReport = new SpotReport();
		}
	}

	@Override
	public SpotReport getModel() {
		return spotReport;
	}

	public String getId() {
		return id;
	}

	public void setId(String id) {
		this.id = id;
	}

	public String getProjectId() {
		return projectId;
	}

	public void setProjectId(String projectId) {
		this.projectId = projectId;
	}

	public String[] getItems() {
		return items;
	}

	public void setItems(String[] items) {
		this.items = items;
	}

	public SpotReport getSpotReport() {
		return spotReport;
	}

	public void setSpotReport(SpotReport spotReport) {
		this.spotReport = spotReport;
	}

	public Page<SpotReport> getPage() {
		return page;
	}

	public void setPage(Page<SpotReport> page) {
		this.page = page;
	}

	public Bridgespot getBridgespot() {
		return bridgespot;
	}

	public void setBridgespot(Bridgespot bridgespot) {
		this.bridgespot = bridgespot;
	}

	public Materialspot getMaterialspot() {
		return materialspot;
	}

	public void setMaterialspot(Materialspot materialspot) {
		this.materialspot = materialspot;
	}

	public Safetyspot getSafetyspot() {
		return safetyspot;
	}

	public void setSafetyspot(Safetyspot safetyspot) {
		this.safetyspot = safetyspot;
	}

	public StructureSpot getStructurespot() {
		return structurespot;
	}

	public void setStructurespot(StructureSpot structurespot) {
		this.structurespot = structurespot;
	}

	public SurfaceSpot getSurfacespot() {
		return surfacespot;
	}

	public void setSurfacespot(SurfaceSpot surfacespot) {
		this.surfacespot = surfacespot;
	}

	public TunnelSpot getTunnelspot() {
		return tunnelspot;
	}

	public void setTunnelspot(TunnelSpot tunnelspot) {
		this.tunnelspot = tunnelspot;
	}

	public PileSpot getPilespot() {
		return pilespot;
	}

	public void setPilespot(PileSpot pilespot) {
		this.pilespot = pilespot;
	}

	public User getUser() {
		return user;
	}

	public String getBat() {
		return bat;
	}

	public void setBat(String bat) {
		this.bat = bat;
	}

	public String getCh() {
		return ch;
	}

	public void setCh(String ch) {
		this.ch = ch;
	}
	

	public JfreeChartBean getJfreeChartBean() {
		return jfreeChartBean;
	}

	public void setJfreeChartBean(JfreeChartBean jfreeChartBean) {
		this.jfreeChartBean = jfreeChartBean;
	}

	public String getStartTime() {
		return startTime;
	}

	public void setStartTime(String startTime) {
		this.startTime = startTime;
	}

	public String getEndTime() {
		return endTime;
	}

	public void setEndTime(String endTime) {
		this.endTime = endTime;
	}

	public String getBatch() {
		return batch;
	}

	public void setBatch(String batch) {
		this.batch = batch;
	}


	@Autowired
	public void setDetectManager(DetectManager detectManager) {
		this.detectManager = detectManager;
	}

	@Autowired
	public void setProjectManager(ProjectManager projectManager) {
		this.projectManager = projectManager;
	}

	public SpotReportVo getSpotReportVo() {
		return spotReportVo;
	}

	public void setSpotReportVo(SpotReportVo spotReportVo) {
		this.spotReportVo = spotReportVo;
	}

	public String getTownItems() {
		return townItems;
	}

	public void setTownItems(String townItems) {
		this.townItems = townItems;
	}

	public String getRoadItems() {
		return roadItems;
	}

	public void setRoadItems(String roadItems) {
		this.roadItems = roadItems;
	}

	public String getLevelItems() {
		return levelItems;
	}

	public void setLevelItems(String levelItems) {
		this.levelItems = levelItems;
	}

	public List<String> getAutowns() {
		return autowns;
	}

	public void setAutowns(List<String> autowns) {
		this.autowns = autowns;
	}

	public String getPlanTypes() {
		return planTypes;
	}

	public void setPlanTypes(String planTypes) {
		this.planTypes = planTypes;
	}

	public String getStartJidu() {
		return startJidu;
	}

	public void setStartJidu(String startJidu) {
		this.startJidu = startJidu;
	}

	public String getEndJidu() {
		return endJidu;
	}

	public void setEndJidu(String endJidu) {
		this.endJidu = endJidu;
	}

	public String getYearTime() {
		return yearTime;
	}

	public void setYearTime(String yearTime) {
		this.yearTime = yearTime;
	}

	public String[] getLuji() {
		return luji;
	}

	public void setLuji(String[] luji) {
		this.luji = luji;
	}

	public String[] getLumian() {
		return lumian;
	}

	public void setLumian(String[] lumian) {
		this.lumian = lumian;
	}

	public String[] getQiaoliang() {
		return qiaoliang;
	}

	public void setQiaoliang(String[] qiaoliang) {
		this.qiaoliang = qiaoliang;
	}

	public String[] getSuidao() {
		return suidao;
	}

	public void setSuidao(String[] suidao) {
		this.suidao = suidao;
	}

	public String[] getSafe() {
		return safe;
	}

	public void setSafe(String[] safe) {
		this.safe = safe;
	}

	public String[] getCailiao() {
		return cailiao;
	}

	public void setCailiao(String[] cailiao) {
		this.cailiao = cailiao;
	}

	public String getLujiString() {
		return lujiString;
	}

	public void setLujiString(String lujiString) {
		this.lujiString = lujiString;
	}

	public String getLumianString() {
		return lumianString;
	}

	public void setLumianString(String lumianString) {
		this.lumianString = lumianString;
	}

	public String getQiaoliangString() {
		return qiaoliangString;
	}

	public void setQiaoliangString(String qiaoliangString) {
		this.qiaoliangString = qiaoliangString;
	}

	public String getSuidaoString() {
		return suidaoString;
	}

	public void setSuidaoString(String suidaoString) {
		this.suidaoString = suidaoString;
	}

	public String getSafeString() {
		return safeString;
	}

	public void setSafeString(String safeString) {
		this.safeString = safeString;
	}

	public String getCailiaoString() {
		return cailiaoString;
	}

	public void setCailiaoString(String cailiaoString) {
		this.cailiaoString = cailiaoString;
	}

	public String getZhibiaoString() {
		return zhibiaoString;
	}

	public void setZhibiaoString(String zhibiaoString) {
		this.zhibiaoString = zhibiaoString;
	}

	/**
	 * zbJidu
	 *
	 * @return  the zbJidu
	 * @since   1.0.0
	 */
	
	public String getZbJidu() {
		return zbJidu;
	}

	/**
	 * @param zbJidu the zbJidu to set
	 */
	public void setZbJidu(String zbJidu) {
		this.zbJidu = zbJidu;
	}

	/**
	 * zbyearTime
	 *
	 * @return  the zbyearTime
	 * @since   1.0.0
	 */
	
	public String getZbyearTime() {
		return zbyearTime;
	}

	/**
	 * @param zbyearTime the zbyearTime to set
	 */
	public void setZbyearTime(String zbyearTime) {
		this.zbyearTime = zbyearTime;
	}

	public String getAlltotal() {
		return alltotal;
	}

	public void setAlltotal(String alltotal) {
		this.alltotal = alltotal;
	}

	/**
	 * kaishi
	 *
	 * @return  the kaishi
	 * @since   1.0.0
	 */
	
	public String getKaishi() {
		return kaishi;
	}

	/**
	 * @param kaishi the kaishi to set
	 */
	public void setKaishi(String kaishi) {
		this.kaishi = kaishi;
	}

	
	public String getProjectName() {
		return projectName;
	}

	public void setProjectName(String projectName) {
		this.projectName = projectName;
	}

	
	public String getYearTime2() {
		return yearTime2;
	}

	public void setYearTime2(String yearTime2) {
		this.yearTime2 = yearTime2;
	}

	public String getStartMonth() {
		return startMonth;
	}

	public void setStartMonth(String startMonth) {
		this.startMonth = startMonth;
	}

	public String getEndMonth() {
		return endMonth;
	}

	public void setEndMonth(String endMonth) {
		this.endMonth = endMonth;
	}

	
	public String getStartYear() {
		return startYear;
	}

	public void setStartYear(String startYear) {
		this.startYear = startYear;
	}

	
	public String getEndYear() {
		return endYear;
	}

	public void setEndYear(String endYear) {
		this.endYear = endYear;
	}

	@Autowired
	public void setSystemManager(SystemManager systemManager) {
		this.systemManager = systemManager;
	}

	/**
	 * biaoduan
	 *
	 * @return  the biaoduan
	 * @since   1.0.0
	 */
	
	public String getBiaoduan() {
		return biaoduan;
	}

	/**
	 * @param biaoduan the biaoduan to set
	 */
	public void setBiaoduan(String biaoduan) {
		this.biaoduan = biaoduan;
	}

	/**
	 * upload
	 *
	 * @return  the upload
	 * @since   1.0.0
	 */
	
	public List<File> getUpload() {
		return upload;
	}

	/**
	 * @param upload the upload to set
	 */
	public void setUpload(List<File> upload) {
		this.upload = upload;
	}

	/**
	 * uploadFileName
	 *
	 * @return  the uploadFileName
	 * @since   1.0.0
	 */
	
	public List<String> getUploadFileName() {
		return uploadFileName;
	}

	/**
	 * @param uploadFileName the uploadFileName to set
	 */
	public void setUploadFileName(List<String> uploadFileName) {
		this.uploadFileName = uploadFileName;
	}

	/**
	 * uploadContentType
	 *
	 * @return  the uploadContentType
	 * @since   1.0.0
	 */
	
	public List<String> getUploadContentType() {
		return uploadContentType;
	}

	/**
	 * @param uploadContentType the uploadContentType to set
	 */
	public void setUploadContentType(List<String> uploadContentType) {
		this.uploadContentType = uploadContentType;
	}
	
}
